package sjjg;

public class TriangularNatrix {

    private int[] aee;

    public TriangularNatrix() {
    }

    public void compress(int[][] arr) {


        int len = (1 + arr.length) * arr.length / 2;
        aee = new int[len];
        int k = 0;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j <= i; j++) {
                aee[k] = arr[i][j];
                k++;
            }
        }


    }

    public int getValue(int i, int j) {
        if (j > i) {
            return 0;
        } else {
            int c = (i + 1) * i / 2 + j;
            System.out.println(aee[c]);
            return aee[c];
        }
    }

}
